<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>附件列表</title>
<meta name="keywords" content="" />
<link rel="stylesheet" type="text/css" href="/common/images/common.css"/>
<link rel="stylesheet" type="text/css" href="images/css.css"/>
<script src="{cfg:(dirpath,base)}/common.php?app=sys&app_act=web.config&app_ajax=1"></script>
<script src="/common/js/kj.js"></script>
<script src="/common/js/kj.ajax.js"></script>
<script src="/common/js/kj.pic.js"></script>
<script src="/common/js/date.js"></script>
<script src="/common/js/kj.page.js"></script>
<style>
body{text-align:left}

.menu{float:left;width:100%;padding-top:5px;background:url(/admin/images/menu_bg.jpg) repeat-x 0px bottom;color:#004499}
.menu li{float:left;border-top:1px #C7D8EA solid;border-left:1px #C7D8EA solid;border-right:1px #C7D8EA solid;margin-left:10px;padding:8px 15px 3px 15px;letter-spacing:5px;cursor:pointer}
.menu .fdpic{float:right;width:15px;height:13px;background:url(table.jpg) no-repeat 0px bottom;padding:8px 0px 0px 0px;border:0px}
.menu .info{border:0px;color:#ff0000}
.menu .sel{background:#ffffff;font-weight:bold}
.menu .z_sel{color:#ff0000}
.menu .x_btn{border:0px;color:#ff0000;padding:8px 5px 3px 5px}


.list1{float:left;width:100%;text-align:center}
.list1 .x_li{float:left;width:250px;height:190px;line-height:20px;overflow:hidden;padding:10px;border:1px #ffffff solid}
.list1 .x_li img{max-width:250px;max-height:150px;_zoom:expression(function(x){ if(x.width>250){x.width=250;}if(x.height>150){x.height=150;}}(this));vertical-align:middle}
.list1 .x_sel{border:1px #ff6600 solid}
.list1 .x_pic{float:left;width:250px;height:175px;overflow:hidden}
.list1 .x_1{float:left;width:250px}
.list1 .xx_1{float:left;width:125px;background:#efefef;}
.list1 .xx_2{float:left;width:125px;background:#CBDDFD;color:#ff8800;}
.div1{float:left;width:100%;padding:8px 0px 10px 0px}
.div1 li{float:left;width:auto;padding:0px 10px 0px 10px}

.div2{float:left;width:100%;padding:15px 0px 5px 0px;border-bottom:1px #cccccc solid}


.list2{float:left;width:100%;text-align:center}
.list2 .x_li{float:left;width:100px;height:100px;line-height:20px;overflow:hidden;padding:10px;border:1px #ffffff solid;cursor:pointer}
.list2 .x_li img{max-width:100px;max-height:70px;_zoom:expression(function(x){ if(x.width>100){x.width=100;}if(x.height>70){x.height=70;}}(this));vertical-align:middle}
.list2 .x_sel{border:1px #ff6600 solid}
.list2 .x_1{position:relative;top:0px;left:0px}
.list2 .xx_1{float:left;width:100px;background:#efefef;}
.list2 .xx_2{float:left;width:50px;background:#CBDDFD;color:#ff8800;}
.list2 .xx_3{float:left;width:50px;}

</style>
<script>
	kj.onload(function(){
		//设置 menu 移动效果
		kj.handler("#id_list1 .x_li","mouseover",function(){
			kj.addClassName(this,'x_sel');
			kj.show(kj.obj(".x_1" , this));
		});
		kj.handler("#id_list1 .x_li","mouseout",function(){
			kj.delClassName(this,'x_sel');
			kj.hide(kj.obj(".x_1" , this));
		});
	});
var thisjs = new function() {
	this.refresh = function(obj) {
		window.location = "?" + this.get_url(obj);
	}
	this.get_url = function(obj) {
		var url = [];
		var i = 0;
		//默认url参数
		url[url.length]='app={$app}';
		url[url.length]='app_module={$app_module}';
		url[url.length]='app_act={$app_act}';
		url[url.length]='callback={fun_get::get("callback")}';
		if(obj) {
			if("page" in obj) url[url.length]='page=' + obj.page;
		}
		//查找相关参数
		var obj_s = kj.obj("input<<name,/^s_/i");
		for(i = 0 ; i < obj_s.length ; i++){
			if(obj_s[i].type == "radio" || obj_s[i].type == "checkbox" ) {
				if( obj_s[i].checked ) url[url.length] = obj_s[i].name + "=" + obj_s[i].value;
			} else {
				if(obj_s[i].value != '') url[url.length] = obj_s[i].name + "=" + obj_s[i].value;
			}
		}
		obj_s = kj.obj("select<<name,/^s_/i");
		for(i = 0 ; i < obj_s.length ; i++){
			if(obj_s[i].value != '') url[url.length] = obj_s[i].name + "=" + obj_s[i].value;
		}
		//自定义相关参数
		obj_s = kj.obj("input<<name,/^url_/i");
		for(i = 0 ; i < obj_s.length ; i++){
			if(obj_s[i].type == "radio" || obj_s[i].type == "checkbox" ) {
				if( obj_s[i].checked ) url[url.length] = obj_s[i].name + "=" + obj_s[i].value;
			} else {
				if(obj_s[i].value != '') url[url.length] = obj_s[i].name + "=" + obj_s[i].value;
			}
		}
		var str = url.join("&");
		return str;
	}
	//清空查询
	this.clear_search = function() {
		kj.set("input<<name,/^s_/i",'value','');
		kj.set("select<<name,/^s_/i",'options[0].selected',true);
		this.refresh();
	}
	this.menu_display = function() {
		var obj = kj.obj("#id_search");
		if(obj.style.display=="none") {
			obj.style.display = '';
		} else {
			obj.style.display = 'none';
		}
	}
	this.sel = function(val) {
		var objid = "{fun_get::get('url_objid')}";
		var callback = "{fun_get::get('callback')}";
		if(!callback) callback = 'attatch_callback';
		var obj;
		var isok = 0;
		if(objid) {
			if(window.opener) {
				obj = window.opener.document.getElementById(objid);
			}
			if(!obj && window.parent) {
				obj = window.parent.document.getElementById(objid);
			}
			if(obj) {
				obj.value = val;
				o = kj.parent(obj , "li");
				isok = 1;
			}
		}
		obj = {};
		obj.url = val;
		obj.objid = objid;
		//回调函数
		if(window.parent && callback in window.parent){
			var fun = "window.parent." + callback +"(obj)";
			eval(fun);
		} else if( window.opener && callback in window.opener) {
			var fun = "window.opener." + callback +"(obj)";
			eval(fun);
		}
		if(isok && window.opener) window.close();
	}
	this.opendir = function(val) {
		kj.obj("#id_url_dirpath").value = val;
		thisjs.refresh();
	}

}
</script>
</head>
<body>
<input type="hidden" name="url_objid" value="{fun_get::get('url_objid')}" id="id_url_objid">
<div class="menu" id="id_menu">
	<li {if($channel != 'server')}class="sel"{/if}><a href="{fun_get::url(array('channel'=>'default'))}">我的空间</a></li>
	{if(cls_obj::get('cls_user')->is_admin())}<li {if($channel == 'server')}class="sel"{/if}><a href="{fun_get::url(array('channel'=>'server'))}">服务器</a></li>{/if}
	{if($channel != 'server')}<li onclick="thisjs.menu_display();" class="x_btn">查找</li>{/if}
</div>
{if($channel == 'server')}
	<input type="hidden" name="url_dirpath" value="{$arr_list['pathdir']}" id="id_url_dirpath">
	<!--显示服务器列表开始-->
	<div class="div2">&nbsp;&nbsp;&nbsp;&nbsp;{$arr_list['path']}</div>
	<div class="list2" id="id_list1">
	{foreach($arr_list['dir'] as $item)}
		<div class="x_li" onclick="thisjs.opendir('{$arr_list['pathdir']}/{$item['name']}');"><img src="images/ico_1/dir.gif"><br>{$item['name']}</div>
	{/foreach}
	{foreach($arr_list['file'] as $item)}
		<div class="x_li">
		{if($item['type'] == 'pic')}
			<a href="javascript:thisjs.sel('{$item['url']}');"><img src="{$item['url_view']}" onerror="this.src='{$temp_baseurl}common/images/no_pic.jpg'"></a>
		{else if($item['type'] == 'rar')}
			<a href="javascript:thisjs.sel('{$item['url']}');');"><img src="images/ico_1/rar.gif"></a>
		{else if($item['type'] == 'media')}
			<a href="javascript:thisjs.sel('{$item['url']}');"><img src="images/ico_1/media.gif"></a>
		{else if(in_array($item['ext'],array('html','htm')))}
			<a href="javascript:thisjs.sel('{$item['url']}');"><img src="images/ico_1/htm.gif"></a>
		{else}
			<a href="javascript:thisjs.sel('{$item['url']}');"><img src="images/ico_1/txt.gif"></a>
		{/if}
		<br>{$item['name']}
		{if($item['type'] == 'pic')}
			<div class='x_1' style="display:none"><div class="xx_1"><span class="xx_2"><a href="javascript:thisjs.sel('{$item['url']}');" style="color:#ff8800">选择</a></span><span class="xx_3"><a href="javascript:kj.pic.preview('{$item['url_view']}');" style="color:#000000">预览</a></span></div></div>
		{else}
			<div class='x_1' style="display:none"><div class="xx_1"><a href="javascript:thisjs.sel('{$item['url']}');" style="color:#ff8800">选择</a></div></div>
		{/if}
		</div>
	{/foreach}
	</div>	<!--显示服务器列表结束-->
{else}
	<!--显示空间列表开始-->
	<div class="div1" id="id_search" {if($arr_list['issearch']==0)}style="display:none"{/if}>
	<li>关键词：<input type="text" name="s_key" id="id_s_key" value="{fun_get::get('s_key')}" class='pTxt1 pTxtL150'></li>
	<li>类型：<input type="checkbox" name="s_type[]" value="pic"{if(in_array('pic',$arr_list['type']))} checked{/if}>图片&nbsp;<input type="checkbox" name="s_type[]" value="flash"{if(in_array('flash',$arr_list['type']))} checked{/if}>flash&nbsp;<input type="checkbox" name="s_type[]" value="media"{if(in_array('media',$arr_list['type']))} checked{/if}>音/视频&nbsp;<input type="checkbox" name="s_type[]" value="rar"{if(in_array('rar',$arr_list['type']))} checked{/if}>附件&nbsp;<input type="checkbox" name="s_type[]" value="doc"{if(in_array('doc',$arr_list['type']))} checked{/if}>文档&nbsp;<input type="checkbox" name="s_type[]" value="other"{if(in_array('other',$arr_list['type']))} checked{/if}>其它</li>
	<li>上传时间：<input type="text" id="s_time1" name="s_time1" value="{fun_get::get('s_time1')}" class='pTxtDate' onfocus="new Calendar().show(this);"> 到 <input type="text" name="s_time2" id="s_time2" value="{fun_get::get('s_time2')}" class='pTxtDate' onfocus="new Calendar().show(this);"></li>
	<li><input type="button" name="btn_s_ok" value="查找" class="pBtn" onclick="thisjs.refresh();"> 　<input type="button" name="btn_s_clear" value="清空" class="pBtn" onclick="thisjs.clear_search();"></li>
	</div>
	<div class="list1" id="id_list1">
	{foreach($arr_list['list'] as $item)}
		<div class="x_li">
			<div class="x_pic"><a href="javascript:thisjs.sel('{$item['attatch_path']}');"><img src="{$item['img']}" onerror="this.src='{$temp_baseurl}common/images/no_pic.jpg'"><br>{$item['attatch_filename']}</a></div>
		{if(!empty($item['attatch_small']))}
		<div class='x_1' style="display:none"><span class="xx_1"><font color='#888888'>大图</font>&nbsp;&nbsp;<a href="javascript:thisjs.sel('{$item['attatch_path']}');" style="color:#ff8800">选择</a>&nbsp;&nbsp;<a href="javascript:kj.pic.preview('{$item['img']}');" style="color:#ff8800">预览</a></span><span class="xx_2"><font color='#888888'>小图</font>&nbsp;&nbsp;<a href="javascript:thisjs.sel('{$item['attatch_small']}');" style="color:#000000">选择</a>&nbsp;&nbsp;<a href="javascript:kj.pic.preview('{$item['img_small']}');" style="color:#000000">预览</a></span></div>
		{else}
		<div class='x_1' style="display:none"><span class="xx_1"><a href="javascript:thisjs.sel('{$item['attatch_path']}');" style="color:#ff8800">选择</a></span><span class="xx_2"><a href="javascript:kj.pic.preview('{$item['img']}');" style="color:#000000">预览</a></span></div>
		{/if}
		</div>
	{/foreach}
	</div>
	<div class="pPage" id="id_pPage">
	{$arr_list['pagebtns']}
	</div>
	<!--显示空间列表结束-->
{/if}
</body>
</html>